#Name: Daniel Bokser
#UNIX ID: db693351

#The following rule tells make about possible suffixes
#(extensions) of file names.

.SUFFIXES: .c .o

#The following definition of CC ensures that
#gcc will be used to compile the C source files.

CC = gcc

#The following definition of CFLAGS ensures that
#the debugger can be used with the executable file (sample)
#created by running make.

CFLAGS = -g -Wall -pthread

#The following rule tells make how a ".o" file should
#be created from the corresponding ".c" file.
#Note that the "-c" option must be used here since we are
#compiling source files separately. (Note that the line
#following the ".c.o:" line begins with the "tab" character.)

client/%.o: %.c
	$(CC) $(CFLAGS) -c $<
server/%.o: %.c
	$(CC) $(CFLAGS) -c $<
#Dependency rule for the default target and how the
#default target is to be created. (Note that the line
#following the dependency rule begins with the "tab"
#character.)
all: cli 

cli: client/cli_main.o client/cli_login.o client/cli_interact.o client/cli_helper.o\
		 client/cli_resp.o client/input.o client/cmdSockFuncs.o client/dataSockFuncs.o
	gcc client/cli_main.o client/cli_login.o client/cli_interact.o client/dataSockFuncs.o\
		 client/cli_helper.o client/cli_resp.o client/input.o client/cmdSockFuncs.o -pthread -o cli


#Dependency rules for other targets. (We don't need to
#specify how these targets are created since we have already
#given a general rule for creating a ".o" file from the
#corresponding ".c" file.)

client/cli_main.o: client/*.h 
client/cli_login.o: client/*.h
client/cli_interact.o: client/*.h
client/cli_helper.o: client/*.h
client/cli_resp.o: client/*.h
client/input.o: client/*.h
client/cmdSockFuncs.o: client/*.h
client/dataSockFuncs.o: client/*.h

#Target for removing unnecessary files.

clean:
	rm -f client/*.o server/*.o client/core server/core
